package cn.cs.service;

import cn.cs.common.Dto;
import cn.cs.mapper.RepairBbsMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class RepairBbsService {

    @Resource
    private RepairBbsMapper repairBbsMapper;

    @RequestMapping(value = "/getRepairBbsCountByMap", method = RequestMethod.POST)
    public Integer  getRepairBbsCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return repairBbsMapper.getRepairBbsCountByMap(param);
    }

    @RequestMapping(value = "/getRepairBbsListByMap", method = RequestMethod.POST)
    public List<Map<String, Object>> getRepairBbsListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return repairBbsMapper.getRepairBbsListByMap(param);
    }

    @RequestMapping(value = "/getBbsImages", method = RequestMethod.POST)
    public List<Map<String,Object>> getBbsImages(@RequestParam("id") String id){
        return repairBbsMapper.getBbsImages(id);
    }

    @RequestMapping(value = "/getReplyTree", method = RequestMethod.POST)
    public List<Map<String,Object>> getReplyTree(@RequestParam("id") String id){
        return repairBbsMapper.getReplyTree(id);
    }

    @RequestMapping(value = "/insertBbsByMap", method = RequestMethod.POST)
    public Integer  insertBbsByMap(@RequestBody Map<String, Object> param)throws Exception{
        return repairBbsMapper.insertBbsByMap(param);
    }

    @RequestMapping(value = "/insertBbsImg", method = RequestMethod.POST)
    public void  insertBbsImg(@RequestBody Map<String, Object> param)throws Exception{
        repairBbsMapper.insertBbsImg(param);
    }

    @RequestMapping(value = "/getBbsById", method = RequestMethod.POST)
    public Map<String,Object> getBbsById(@RequestParam("id") String id){
        return repairBbsMapper.getBbsById(id);
    }

    @RequestMapping(value = "/getReplyById", method = RequestMethod.POST)
    public Map<String,Object> getReplyById(@RequestParam("id") String id){
        return repairBbsMapper.getReplyById(id);
    }

    @RequestMapping(value = "/updateBbs", method = RequestMethod.POST)
    public void  updateBbs(@RequestBody Map<String, Object> param)throws Exception{
        repairBbsMapper.updateBbs(param);
    }

    @RequestMapping(value = "/insertReply", method = RequestMethod.POST)
    public Integer  insertReply(@RequestBody Map<String, Object> param)throws Exception{
        return repairBbsMapper.insertReply(param);
    }

    @RequestMapping(value = "/updateBBSRecommend", method = RequestMethod.POST)
    public Integer updateBBSRecommend(@RequestBody Map<String, Object> param)throws Exception{
        return repairBbsMapper.updateBBSRecommend(param);
    }

}
